|
![](/i/fill.gif) |
> The easiest is usually to use 'trace()'. You can use the returned normal
> vector to determine the slope at the position.
>
> Christoph
I've seen lots of cool stuff done with trace but I've never dabbled with it
myself. I read the docs on it and I'm a bit confused. I have a heightfield
named canyon, and this is a nested loop to test for an intersection. It
should always intersect so it should always generate a sphere (I havn't the
slightest how to test for the slope yet), but it loops infinetly and I dunno
why. I'm not too good at Macros yet. =)
Here is my code, can someone point me in the right direction?
#declare Norm = <0, 0, 0>;
#declare Start = <0, 2, 0>;
#declare End = <0, 0, 0>;
#declare Counter = 100;
#declare xCount = Counter;
#declare zCount = Counter;
#while (xCount != 0)
#while (zCount != 0)
#declare End = <xCount/Counter,0,zCount/Counter>;
#declare Start = End + <0,2,0>;
#declare Inter = trace ( canyon, Start, End, Norm );
#if (vlength(Norm)!=0)
sphere {
Inter, .2
texture {
pigment {color green 1}
}
}
#declare zCount = zCount - 1;
#end
#declare xCount = xCount - 1;
#end
Corey
Post a reply to this message
|
![](/i/fill.gif) |